Manages the Compositor available in the component. More...
Public Member Functions | |
CompositorManager () | |
~CompositorManager () | |
Compositor * | getActiveCompositor () const |
Compositor * | getDefaultCompositor () const |
Compositor * | createOrRetrieve (const std::string_view &name) |
Compositor * | get (const std::string_view &name) |
Compositor * | getByIndex (unsigned int index) |
void | rename (const std::string_view &oldName, const std::string_view &newName) |
void | erase (const std::string_view &name) |
void | setActiveCompositor (Compositor *compositor) |
void | setDefaultCompositor (Compositor *compositor) |
void | prepareForContext (RenderContext *context) |
Manages the Compositor available in the component.
At all times, memory returned by the manager is owned by it. External code should never delete memory it retrieved from it.
nkGraphics::CompositorManager::CompositorManager | ( | ) |
Constructor.
nkGraphics::CompositorManager::~CompositorManager | ( | ) |
Destructor.
Compositor* nkGraphics::CompositorManager::getActiveCompositor | ( | ) | const |
Compositor* nkGraphics::CompositorManager::getDefaultCompositor | ( | ) | const |
Compositor* nkGraphics::CompositorManager::createOrRetrieve | ( | const std::string_view & | name | ) |
Creates if unavailable, or retrieves if available, a compositor attached to given name.
name | The name of the compositor to retrieve. |
Compositor* nkGraphics::CompositorManager::get | ( | const std::string_view & | name | ) |
Retrieves an existing compositor.
name | The name of the compositor to retrieve. |
Compositor* nkGraphics::CompositorManager::getByIndex | ( | unsigned int | index | ) |
Retrieves a compositor by index. Keep in mind that as compositors are added / erased, the same index can return a different compositor. This function is useful when retrieving all existing compositors in one go.
index | The index from which to retrieve a compositor. |
void nkGraphics::CompositorManager::rename | ( | const std::string_view & | oldName, |
const std::string_view & | newName | ||
) |
Renames a compositor.
oldName | The name currently used by the compositor. |
newName | The new name the compositor should get. |
void nkGraphics::CompositorManager::erase | ( | const std::string_view & | name | ) |
Erases and frees memory used by a compositor.
name | The name of the compositor to erase. |
void nkGraphics::CompositorManager::setActiveCompositor | ( | Compositor * | compositor | ) |
Sets the compositor currently active. This compositor will be the reference for given rendering iteration.
compositor | The compositor to use. |
void nkGraphics::CompositorManager::setDefaultCompositor | ( | Compositor * | compositor | ) |
Sets the default compositor. This compositor will be the activated one when a context has no compositor attached.
compositor | The compositor to use. |
void nkGraphics::CompositorManager::prepareForContext | ( | RenderContext * | context | ) |
Prepares the rendering and sets as active the compositor tied to the context given. If none is set, the default compositor will be activated.
context | The context from which to activate a compositor. |